package com.stenio.fancat.common.interceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author zhangqiu
 * @date 2018/12/1
 * @desc
 **/
@Configuration
public class WebInterceptorAdapter implements WebMvcConfigurer {
    @Bean
    public CORSInterceptor corsInterceptor(){
        return new CORSInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(corsInterceptor()).addPathPatterns("/**");
    }
}
